// showToast
export default {
  namespaced: true,
  state: {
    // 是否显示提示框
    isShowToast: false,
    // 提示信息
    toastMsg: '提示信息',
    // 提示类型 success,danger,warning
    toastType: 'danger'
  },
  mutations: {
    changeIsShowToast(state, payload) {
      // console.log('值：', payload)
      state.isShowToast = payload.isshow
      if (payload.isshow) {
        state.toastMsg = payload.msg
        state.toastType = payload.type
      }
    }
  },
  actions: {
    asyncChangeIsShowToast({ commit }, payload) {
      commit('changeIsShowToast', payload)
      setTimeout(() => {
        commit('changeIsShowToast', { isshow: false })
      }, 2000)
    }
  }
}
